<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="stable/static/css/site.css" rel="stylesheet" type="text/css">
    <link href="stable/static/css/print.css" rel="stylesheet" type="text/css" media="print">
    <link href="stable/static/css/prettify.css" rel="stylesheet" type="text/css">
    <link href="//www.google.com/images/icons/product/chrome-16.png" rel="icon" type="image/ico">
    <link href="stable/static/css/api.css" rel="stylesheet" type="text/css">
    <title>chrome.downloads - chrome插件中文开发文档(非官方)</title>
  </head>
  <body>
    <a id="top"></a>
    <div id="header">{Header content}</div>
    <a id="gc-topnav-anchor"></a>
    <div id="gc-topnav">
      <h1>Google Chrome Extensions</h1>
      <ul id="home" class="gc-topnav-tabs">
        <li id="home_link">
          <a href="index.html" title="Google Chrome Extensions home page"><div>Home</div></a>
        </li>
        <li id="docs_link">
          <a href="docs.html" title="Official Google Chrome Extensions documentation"><div>Docs</div></a>
        </li>
        <li id="faq_link">
          <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions"><div>FAQ</div></a>
        </li>
        <li id="samples_link">
          <a href="samples.html" title="Sample Extensions (with source code)"><div>Samples</div></a>
        </li>
        <li id="group_link">
          <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum"><div>Group</div></a>
        </li>
        <li id="so_link">
          <a href="http://stackoverflow.com/questions/tagged/google-chrome-extension" title="[google-chrome-extension] tag on Stack Overflow"><div>Questions?</div></a>
        </li>
      </ul>
    </div>
    <div id="gc-container">
      <div id="gc-sidebar">
        <ul 
            class="level1 ">
          <li class="level2">
                <a href="getstarted.html" class="level2 ">Getting Started</a>
          </li>
          <li class="level2">
                <a href="overview.html" class="level2 ">Overview</a>
          </li>
          <li class="level2">
                <a href="whats_new.html" class="level2 ">What's New?</a>
          </li>
          <li class="level2">
                <a href="devguide.html" class="level2 ">Developer's Guide</a>
              <ul 
                  class="level2 ">
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Browser UI</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="browserAction.html" class="level4 ">Browser Actions</a>
                      </li>
                      <li class="level4">
                            <a href="contextMenus.html" class="level4 ">Context Menus</a>
                      </li>
                      <li class="level4">
                            <a href="notifications.html" class="level4 ">Desktop Notifications</a>
                      </li>
                      <li class="level4">
                            <a href="omnibox.html" class="level4 ">Omnibox</a>
                      </li>
                      <li class="level4">
                            <a href="options.html" class="level4 ">Options Pages</a>
                      </li>
                      <li class="level4">
                            <a href="override.html" class="level4 ">Override Pages</a>
                      </li>
                      <li class="level4">
                            <a href="pageAction.html" class="level4 ">Page Actions</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Browser Interaction</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="bookmarks.html" class="level4 ">Bookmarks</a>
                      </li>
                      <li class="level4">
                            <a href="cookies.html" class="level4 ">Cookies</a>
                      </li>
                      <li class="level4">
                            <a href="devtools.html" class="level4 ">Developer Tools</a>
                      </li>
                      <li class="level4">
                            <a href="events.html" class="level4 ">Events</a>
                      </li>
                      <li class="level4">
                            <a href="history.html" class="level4 ">History</a>
                      </li>
                      <li class="level4">
                            <a href="management.html" class="level4 ">Management</a>
                      </li>
                      <li class="level4">
                            <a href="tabs.html" class="level4 ">Tabs</a>
                      </li>
                      <li class="level4">
                            <a href="windows.html" class="level4 ">Windows</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Implementation</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="a11y.html" class="level4 ">Accessibility</a>
                      </li>
                      <li class="level4">
                            <a href="event_pages.html" class="level4 ">Event Pages</a>
                      </li>
                      <li class="level4">
                            <a href="contentSecurityPolicy.html" class="level4 ">Content Security Policy</a>
                      </li>
                      <li class="level4">
                            <a href="content_scripts.html" class="level4 ">Content Scripts</a>
                      </li>
                      <li class="level4">
                            <a href="xhr.html" class="level4 ">Cross-Origin XHR</a>
                      </li>
                      <li class="level4">
                            <a href="i18n.html" class="level4 ">Internationalization</a>
                      </li>
                      <li class="level4">
                            <a href="messaging.html" class="level4 ">Message Passing</a>
                      </li>
                      <li class="level4">
                            <a href="permissions.html" class="level4 ">Optional Permissions</a>
                      </li>
                      <li class="level4">
                            <a href="npapi.html" class="level4 ">NPAPI Plugins</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Finishing</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="hosting.html" class="level4 ">Hosting</a>
                      </li>
                      <li class="level4">
                            <a href="external_extensions.html" class="level4 ">Other Deployment Options</a>
                      </li>
                    </ul>
                </li>
              </ul>
          </li>
          <li class="level2">
                <a href="tutorials.html" class="level2 ">Tutorials</a>
              <ul 
                  class="level2 ">
                <li class="level3">
                      <a href="tut_migration_to_manifest_v2.html" class="level3 ">Manifest V2</a>
                </li>
                <li class="level3">
                      <a href="tut_debugging.html" class="level3 ">Debugging</a>
                </li>
                <li class="level3">
                      <a href="tut_analytics.html" class="level3 ">Google Analytics</a>
                </li>
                <li class="level3">
                      <a href="tut_oauth.html" class="level3 ">OAuth</a>
                </li>
              </ul>
          </li>
          <li class="level2">
                <span class="level2">Reference</span>
              <ul 
                  class="level2 ">
                <li class="level3">
                    <a class="button level3">
                      <span class="level3">Formats</span>
                      <div class="toggleIndicator level3"></div>
                    </a>
                    <ul toggleable
                        class="level3 hidden">
                      <li class="level4">
                            <a href="manifest.html" class="level4 ">Manifest Files</a>
                      </li>
                      <li class="level4">
                            <a href="match_patterns.html" class="level4 ">Match Patterns</a>
                      </li>
                    </ul>
                </li>
                <li class="level3">
                      <a href="permission_warnings.html" class="level3 ">Permission Warnings</a>
                </li>
                <li class="level3">
                      <a href="api_index.html" class="level3 ">chrome.* APIs</a>
                </li>
                <li class="level3">
                      <a href="api_other.html" class="level3 ">Other APIs</a>
                </li>
              </ul>
          </li>
          <li class="level2">
                <span class="level2">More</span>
              <ul 
                  class="level2 ">
                <li class="level3">
                      <a href="http://code.google.com/chrome/webstore/docs/index.html" class="level3 ">Chrome Web Store</a>
                </li>
                <li class="level3">
                      <a href="http://code.google.com/chrome/apps/docs/developers_guide.html" class="level3 ">Hosted Apps</a>
                </li>
                <li class="level3">
                      <a href="themes.html" class="level3 ">Themes</a>
                </li>
              </ul>
          </li>
        </ul>
      </div>
      <div id="gc-pagecontent">
        <h1 class="page_title">chrome.downloads</h1>
        
        <p class="warning">  <em>Warning:</em> This API is still under development. It is only  available for Chrome users on the  <span>    <strong>dev</strong>      <a href="http://www.chromium.org/getting-involved/dev-channel">early      release channel</a>.</span></p>
        
        <div id="toc">
          <h2>Contents</h2>
          <ol>
            <li>
              <a href=#manifest>Manifest</a>
            </li>
            <li>
              <a href=#examples>Examples</a>
            </li>
            <li>
              <a href="#apiReference">API reference: chrome.downloads</a>
              <ol>
                  <li><a href="#types">Types</a><ol>  <li>    <a href="#type-HeaderNameValuePair">HeaderNameValuePair</a>  </li>  <li>    <a href="#type-HttpMethod">HttpMethod</a>  </li>  <li>    <a href="#type-DownloadOptions">DownloadOptions</a>  </li>  <li>    <a href="#type-DangerType">DangerType</a>  </li>  <li>    <a href="#type-State">State</a>  </li>  <li>    <a href="#type-DownloadItem">DownloadItem</a>  </li>  <li>    <a href="#type-DownloadQuery">DownloadQuery</a>  </li>  <li>    <a href="#type-DownloadStringDiff">DownloadStringDiff</a>  </li>  <li>    <a href="#type-DownloadLongDiff">DownloadLongDiff</a>  </li>  <li>    <a href="#type-DownloadBooleanDiff">DownloadBooleanDiff</a>  </li>  <li>    <a href="#type-DownloadDelta">DownloadDelta</a>  </li>  <li>    <a href="#type-GetFileIconOptions">GetFileIconOptions</a>  </li></ol></li>
                  
                  <li><a href="#methods">Methods</a><ol>  <li><a href="#method-download">download</a></li>  <li><a href="#method-search">search</a></li>  <li><a href="#method-pause">pause</a></li>  <li><a href="#method-resume">resume</a></li>  <li><a href="#method-cancel">cancel</a></li>  <li><a href="#method-getFileIcon">getFileIcon</a></li></ol></li>
                  <li><a href="#events">Events</a><ol>  <li><a href="#event-onCreated">onCreated</a></li>  <li><a href="#event-onErased">onErased</a></li>  <li><a href="#event-onChanged">onChanged</a></li></ol></li>
                  <li><a href="#samples">Sample Extensions</a></li>
              </ol>
            </li>
          </ol>
        </div>

<p>The downloads API allows you to programmatically initiate, monitor,
manipulate, and search for downloads.</p>

<h2 id='manifest'>Manifest</h2>

<p> You must declare the 'downloads' permission in the <a
href='manifest.html'>extension manifest</a> to use this API, along with <a
href='manifest.html#permissions'>host permissions</a> for any hosts that you
may pass to <a href='#method-download'>download()</a>.</p>

<pre>{
  'name': 'My extension',
  ...
<b>  'permissions': [
    'downloads',
    '*://*.google.com'
  ]</b>,
  ...
}</pre>

<p>If the URL's hostname is not specified in the permissions, then <a
href='#method-download'>download()</a> will call its callback with a null
<code>downloadId</code> and set the <a
href='extension.html#property-lastError'>chrome.extensions.lastError</a>
object to indicate that the extension does not have permission to access that
hostname.</p>

<h2 id='examples'>Examples</h2>

<p>You can find simple examples of using the downloads module in the <a
href='http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/downloads/'>examples/api/downloads</a>
directory. For other examples and for help in viewing the source code, see <a
href='samples.html'>Samples</a>.</p>
        <h2 id="apiReference">API Reference: chrome.downloads</h2>
        <div class="api_reference">
            <h3 id="types">Types</h3>
              <div>
                <h3 id="type-HeaderNameValuePair">HeaderNameValuePair</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="HeaderNameValuePair-properties">
                    Properties of <a href="#type-HeaderNameValuePair">HeaderNameValuePair</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-HeaderNameValuePair-name"></a>
                      <dt>
                        <span class="variable">name</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Name of the HTTP header.
                      </dd>
                    </div>
                    <div>
                      <a name="property-HeaderNameValuePair-value"></a>
                      <dt>
                        <span class="variable">value</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Value of the HTTP header.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-HttpMethod">HttpMethod</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">enumerated string ["GET", "POST"]</span>  )</span></dt>
              <dd>
                    
                  </dd>  </div>
              </div>
              <div>
                <h3 id="type-DownloadOptions">DownloadOptions</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadOptions-properties">
                    Properties of <a href="#type-DownloadOptions">DownloadOptions</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadOptions-body"></a>
                      <dt>
                        <span class="variable">body</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Post body.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadOptions-saveAs"></a>
                      <dt>
                        <span class="variable">saveAs</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Use a file-chooser to allow the user to select a filename.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadOptions-url"></a>
                      <dt>
                        <span class="variable">url</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The URL to download.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadOptions-filename"></a>
                      <dt>
                        <span class="variable">filename</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        A file path relative to the Downloads directory to contain the downloaded file.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadOptions-headers"></a>
                      <dt>
                        <span class="variable">headers</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">array of <a href="downloads.html#type-HeaderNameValuePair">HeaderNameValuePair</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys <code>name</code> and either <code>value</code> or <code>binaryValue</code>, restricted to those allowed by XMLHttpRequest.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadOptions-method"></a>
                      <dt>
                        <span class="variable">method</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-HttpMethod">HttpMethod</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The HTTP method to use if the URL uses the HTTP[S] protocol.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-DangerType">DangerType</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">enumerated string ["file", "url", "content", "uncommon", "safe"]</span>  )</span></dt>
              <dd>
                    <dl><dt>file</dt>     <dd>The download's filename is suspicious.</dd>     <dt>url</dt>     <dd>The download's URL is known to be malicious.</dd>     <dt>content</dt>     <dd>The downloaded file is known to be malicious.</dd>     <dt>uncommon</dt>     <dd>The download's URL is not commonly downloaded and could be     dangerous.</dd>     <dt>safe</dt>     <dd>The download presents no known danger to the user's computer.</dd> </dl> These string constants will never change, however the set of DangerTypes may change.
                  </dd>  </div>
              </div>
              <div>
                <h3 id="type-State">State</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">enumerated string ["in_progress", "interrupted", "complete"]</span>  )</span></dt>
              <dd>
                    <dl><dt>in_progress</dt>     <dd>The download is currently receiving data from the server.</dd>     <dt>interrupted</dt>     <dd>An error broke the connection with the file host.</dd>     <dt>complete</dt>     <dd>The download completed successfully.</dd> </dl> These string constants will never change, however the set of States may change.
                  </dd>  </div>
              </div>
              <div>
                <h3 id="type-DownloadItem">DownloadItem</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadItem-properties">
                    Properties of <a href="#type-DownloadItem">DownloadItem</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadItem-bytesReceived"></a>
                      <dt>
                        <span class="variable">bytesReceived</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of bytes received so far from the host, without considering file compression.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-danger"></a>
                      <dt>
                        <span class="variable">danger</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate"><a href="downloads.html#type-DangerType">DangerType</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Indication of whether this download is thought to be safe or known to be suspicious.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-url"></a>
                      <dt>
                        <span class="variable">url</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Absolute URL.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-totalBytes"></a>
                      <dt>
                        <span class="variable">totalBytes</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of bytes in the whole file, without considering file compression, or -1 if unknown.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-dangerAccepted"></a>
                      <dt>
                        <span class="variable">dangerAccepted</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        True if the user has accepted the download's danger.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-filename"></a>
                      <dt>
                        <span class="variable">filename</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Absolute local path.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-paused"></a>
                      <dt>
                        <span class="variable">paused</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        True if the download has stopped reading data from the host, but kept the connection open.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-state"></a>
                      <dt>
                        <span class="variable">state</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate"><a href="downloads.html#type-State">State</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Indicates whether the download is progressing, interrupted, or complete.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-mime"></a>
                      <dt>
                        <span class="variable">mime</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The file's MIME type.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-fileSize"></a>
                      <dt>
                        <span class="variable">fileSize</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of bytes in the whole file post-decompression, or -1 if unknown.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-startTime"></a>
                      <dt>
                        <span class="variable">startTime</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of milliseconds between the unix epoch and when this download began.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-error"></a>
                      <dt>
                        <span class="variable">error</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number indicating why a download was interrupted.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-endTime"></a>
                      <dt>
                        <span class="variable">endTime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of milliseconds between the unix epoch and when this download ended.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-id"></a>
                      <dt>
                        <span class="variable">id</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        An identifier that is persistent across browser sessions.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadItem-incognito"></a>
                      <dt>
                        <span class="variable">incognito</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        False if this download is recorded in the history, true if it is not recorded.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-DownloadQuery">DownloadQuery</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadQuery-properties">
                    Properties of <a href="#type-DownloadQuery">DownloadQuery</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadQuery-orderBy"></a>
                      <dt>
                        <span class="variable">orderBy</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Setting this string to a <a href='#type-DownloadItem'>DownloadItem</a> property sorts the <a href='#type-DownloadItem'>DownloadItems</a> prior to applying the above filters. For example, setting <code>orderBy='startTime'</code> sorts the <a href='#type-DownloadItem'>DownloadItems</a> by their start time in ascending order. To specify descending order, prefix <code>orderBy</code> with a hyphen: '-startTime'.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-urlRegex"></a>
                      <dt>
                        <span class="variable">urlRegex</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>url</code> matches the given regular expression.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-endedBefore"></a>
                      <dt>
                        <span class="variable">endedBefore</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that ended before the given ms since the epoch.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-totalBytesGreater"></a>
                      <dt>
                        <span class="variable">totalBytesGreater</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>totalBytes</code> is greater than the given integer.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-danger"></a>
                      <dt>
                        <span class="variable">danger</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DangerType">DangerType</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Indication of whether this download is thought to be safe or known to be suspicious.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-totalBytes"></a>
                      <dt>
                        <span class="variable">totalBytes</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of bytes in the whole file, without considering file compression, or -1 if unknown.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-paused"></a>
                      <dt>
                        <span class="variable">paused</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        True if the download has stopped reading data from the host, but kept the connection open.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-filenameRegex"></a>
                      <dt>
                        <span class="variable">filenameRegex</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> matches the given regular expression.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-query"></a>
                      <dt>
                        <span class="variable">query</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        This space-separated string of search terms that may be grouped using quotation marks limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> or <code>url</code> contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-totalBytesLess"></a>
                      <dt>
                        <span class="variable">totalBytesLess</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>totalBytes</code> is less than the given integer.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-id"></a>
                      <dt>
                        <span class="variable">id</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The <code>id</code> of the <a href="#type-DownloadItem">DownloadItem</a> that changed.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-bytesReceived"></a>
                      <dt>
                        <span class="variable">bytesReceived</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of bytes received so far from the host, without considering file compression.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-endedAfter"></a>
                      <dt>
                        <span class="variable">endedAfter</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that ended after the given ms since the epoch.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-filename"></a>
                      <dt>
                        <span class="variable">filename</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Absolute local path.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-state"></a>
                      <dt>
                        <span class="variable">state</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-State">State</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Indicates whether the download is progressing, interrupted, or complete.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-startedAfter"></a>
                      <dt>
                        <span class="variable">startedAfter</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that started after the given ms since the epoch.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-dangerAccepted"></a>
                      <dt>
                        <span class="variable">dangerAccepted</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        True if the user has accepted the download's danger.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-mime"></a>
                      <dt>
                        <span class="variable">mime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The file's MIME type.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-fileSize"></a>
                      <dt>
                        <span class="variable">fileSize</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of bytes in the whole file post-decompression, or -1 if unknown.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-startTime"></a>
                      <dt>
                        <span class="variable">startTime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of milliseconds between the unix epoch and when this download began.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-url"></a>
                      <dt>
                        <span class="variable">url</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Absolute URL.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-startedBefore"></a>
                      <dt>
                        <span class="variable">startedBefore</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Limits results to <a href='#type-DownloadItem'>DownloadItems</a> that started before the given ms since the epoch.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-limit"></a>
                      <dt>
                        <span class="variable">limit</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Setting this integer limits the number of results. Otherwise, all matching <a href='#type-DownloadItem'>DownloadItems</a> will be returned.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-error"></a>
                      <dt>
                        <span class="variable">error</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number indicating why a download was interrupted.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadQuery-endTime"></a>
                      <dt>
                        <span class="variable">endTime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        Number of milliseconds between the unix epoch and when this download ended.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-DownloadStringDiff">DownloadStringDiff</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadStringDiff-properties">
                    Properties of <a href="#type-DownloadStringDiff">DownloadStringDiff</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadStringDiff-current"></a>
                      <dt>
                        <span class="variable">current</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                    </div>
                    <div>
                      <a name="property-DownloadStringDiff-previous"></a>
                      <dt>
                        <span class="variable">previous</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">string</span>
                          )
                        </span>
                      </dt>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-DownloadLongDiff">DownloadLongDiff</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadLongDiff-properties">
                    Properties of <a href="#type-DownloadLongDiff">DownloadLongDiff</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadLongDiff-current"></a>
                      <dt>
                        <span class="variable">current</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                    </div>
                    <div>
                      <a name="property-DownloadLongDiff-previous"></a>
                      <dt>
                        <span class="variable">previous</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-DownloadBooleanDiff">DownloadBooleanDiff</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadBooleanDiff-properties">
                    Properties of <a href="#type-DownloadBooleanDiff">DownloadBooleanDiff</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadBooleanDiff-current"></a>
                      <dt>
                        <span class="variable">current</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                    </div>
                    <div>
                      <a name="property-DownloadBooleanDiff-previous"></a>
                      <dt>
                        <span class="variable">previous</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">boolean</span>
                          )
                        </span>
                      </dt>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-DownloadDelta">DownloadDelta</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="DownloadDelta-properties">
                    Properties of <a href="#type-DownloadDelta">DownloadDelta</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-DownloadDelta-danger"></a>
                      <dt>
                        <span class="variable">danger</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadStringDiff">DownloadStringDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>danger</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-url"></a>
                      <dt>
                        <span class="variable">url</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadStringDiff">DownloadStringDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>url</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-totalBytes"></a>
                      <dt>
                        <span class="variable">totalBytes</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadLongDiff">DownloadLongDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>totalBytes</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-dangerAccepted"></a>
                      <dt>
                        <span class="variable">dangerAccepted</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadBooleanDiff">DownloadBooleanDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>dangerAccepted</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-filename"></a>
                      <dt>
                        <span class="variable">filename</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadStringDiff">DownloadStringDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>filename</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-paused"></a>
                      <dt>
                        <span class="variable">paused</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadBooleanDiff">DownloadBooleanDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>paused</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-state"></a>
                      <dt>
                        <span class="variable">state</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadStringDiff">DownloadStringDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>state</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-mime"></a>
                      <dt>
                        <span class="variable">mime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadStringDiff">DownloadStringDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>mime</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-fileSize"></a>
                      <dt>
                        <span class="variable">fileSize</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadLongDiff">DownloadLongDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>fileSize</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-startTime"></a>
                      <dt>
                        <span class="variable">startTime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadLongDiff">DownloadLongDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>startTime</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-error"></a>
                      <dt>
                        <span class="variable">error</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadLongDiff">DownloadLongDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>error</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-endTime"></a>
                      <dt>
                        <span class="variable">endTime</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate"><a href="downloads.html#type-DownloadLongDiff">DownloadLongDiff</a></span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The change in <code>endTime</code>, if any.
                      </dd>
                    </div>
                    <div>
                      <a name="property-DownloadDelta-id"></a>
                      <dt>
                        <span class="variable">id</span>
                        <span class="property">
                          (
                            
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        An identifier that is persistent across browser sessions.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
              <div>
                <h3 id="type-GetFileIconOptions">GetFileIconOptions</h3>
                <div>
                  <dt><span class="type_name">  (    <span id="typeTemplate">object</span>  )</span></dt>
                  <h4 id="GetFileIconOptions-properties">
                    Properties of <a href="#type-GetFileIconOptions">GetFileIconOptions</a>
                  </h4>
                  <dd><dl>      <div>
                      <a name="property-GetFileIconOptions-size"></a>
                      <dt>
                        <span class="variable">size</span>
                        <span class="property">
                          (
                            <span class="optional">optional</span>
                            <span id="typeTemplate">integer</span>
                          )
                        </span>
                      </dt>
                      <dd>
                        The size of the icon.  The returned icon will be square with dimensions size * size pixels.  The default size for the icon is 32x32 pixels.
                      </dd>
                    </div>
              </dl></dd>
                </div>
              </div>
            <h3 id="methods">Methods</h3>
              <div>
                <h4 id="method-download">download</h4>
                <div class="summary lower">
                  <span>chrome.downloads.download</span>(<span><a href="downloads.html#type-DownloadOptions">DownloadOptions</a> <span class="variable">options</span></span>)
                </div>
                <div class="description">
              <p>
                    Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both <code>filename</code> and <code>saveAs</code> are specified, then the Save As dialog will be displayed, pre-populated with the specified <code>filename</code>. If the download started successfully, <code>callback</code> will be called with the new <a href='#type-DownloadItem'>DownloadItem</a>'s <code>downloadId</code>. If there was an error starting the download, then <code>callback</code> will be called with <code>downloadId=undefined</code> and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. You must not parse it.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-download-options"></a>  <dt>    <span class="variable">options</span>    <span class="property">      (                <span id="typeTemplate"><a href="downloads.html#type-DownloadOptions">DownloadOptions</a></span>      )    </span>  </dt>  <dd>    What to download and how.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function(integer downloadId) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-downloadId"></a>  <dt>    <span class="variable">downloadId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-search">search</h4>
                <div class="summary lower">
                  <span>chrome.downloads.search</span>(<span><a href="downloads.html#type-DownloadQuery">DownloadQuery</a> <span class="variable">query</span></span>)
                </div>
                <div class="description">
              <p>
                    Find <a href='#type-DownloadItem'>DownloadItems</a>. Set <code>query</code> to the empty object to get all <a href='#type-DownloadItem'>DownloadItems</a>. To get a specific <a href='#type-DownloadItem'>DownloadItem</a>, set only the <code>id</code> field.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-search-query"></a>  <dt>    <span class="variable">query</span>    <span class="property">      (                <span id="typeTemplate"><a href="downloads.html#type-DownloadQuery">DownloadQuery</a></span>      )    </span>  </dt></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(array of <a href="downloads.html#type-DownloadItem">DownloadItem</a> results) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-results"></a>  <dt>    <span class="variable">results</span>    <span class="property">      (                <span id="typeTemplate">array of <a href="downloads.html#type-DownloadItem">DownloadItem</a></span>      )    </span>  </dt></div></dl>
                </div>
              </div>
              <div>
                <h4 id="method-pause">pause</h4>
                <div class="summary lower">
                  <span>chrome.downloads.pause</span>(<span>integer <span class="variable">downloadId</span></span>)
                </div>
                <div class="description">
              <p>
                    Pause the download. If the request was successful the download is in a paused state. Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. The request will fail if the download is not active.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-pause-downloadId"></a>  <dt>    <span class="variable">downloadId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The id of the download to pause.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function() <span class="subdued">{...}</span>;</pre><dl>  </dl>
                </div>
              </div>
              <div>
                <h4 id="method-resume">resume</h4>
                <div class="summary lower">
                  <span>chrome.downloads.resume</span>(<span>integer <span class="variable">downloadId</span></span>)
                </div>
                <div class="description">
              <p>
                    Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. The request will fail if the download is not active.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-resume-downloadId"></a>  <dt>    <span class="variable">downloadId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The id of the download to resume.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function() <span class="subdued">{...}</span>;</pre><dl>  </dl>
                </div>
              </div>
              <div>
                <h4 id="method-cancel">cancel</h4>
                <div class="summary lower">
                  <span>chrome.downloads.cancel</span>(<span>integer <span class="variable">downloadId</span></span>)
                </div>
                <div class="description">
              <p>
                    Cancel a download. When <code>callback</code> is run, the download is cancelled, completed, interrupted or doesn't exist anymore.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-cancel-downloadId"></a>  <dt>    <span class="variable">downloadId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The id of the download to cancel.  </dd></div>
                  </dl>
                  <h4>Callback function</h4><p>      If you specify the <em>callback</em> parameter, it should      specify a function that looks like this:</p><pre>function() <span class="subdued">{...}</span>;</pre><dl>  </dl>
                </div>
              </div>
              <div>
                <h4 id="method-getFileIcon">getFileIcon</h4>
                <div class="summary lower">
                  <span>chrome.downloads.getFileIcon</span>(<span>integer <span class="variable">downloadId</span></span>, <span class="optional"><a href="downloads.html#type-GetFileIconOptions">GetFileIconOptions</a> <span class="variable">options</span></span>)
                </div>
                <div class="description">
              <p>
                    Retrieve an icon for the specified download. For new downloads, file icons are available after the <a href='#event-onCreated'>onCreated</a> event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will contain an error message.
                  </p>    <h4>Parameters</h4>
                  <dl>
                    <div>  <a name="property-getFileIcon-downloadId"></a>  <dt>    <span class="variable">downloadId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The identifier for the download.  </dd></div><div>  <a name="property-getFileIcon-options"></a>  <dt>    <span class="variable">options</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate"><a href="downloads.html#type-GetFileIconOptions">GetFileIconOptions</a></span>      )    </span>  </dt></div>
                  </dl>
                  <h4>Callback function</h4><p>      The <em>callback</em> parameter should specify a function      that looks like this:</p><pre>function(string iconURL) <span class="subdued">{...}</span>;</pre><dl>  <div>  <a name="property-callback-iconURL"></a>  <dt>    <span class="variable">iconURL</span>    <span class="property">      (        <span class="optional">optional</span>        <span id="typeTemplate">string</span>      )    </span>  </dt></div></dl>
                </div>
              </div>
            <h3 id="events">Events</h3>
              <div>
                <h4 id="event-onCreated">onCreated</h4>
                <div class="summary">
                  <span class="subdued">chrome.downloads.</span>onCreated<span class="subdued">.addListener</span>(function(<span><a href="downloads.html#type-DownloadItem">DownloadItem</a> <span class="variable">downloadItem</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> object when a download begins.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onCreated-downloadItem"></a>  <dt>    <span class="variable">downloadItem</span>    <span class="property">      (                <span id="typeTemplate"><a href="downloads.html#type-DownloadItem">DownloadItem</a></span>      )    </span>  </dt></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onErased">onErased</h4>
                <div class="summary">
                  <span class="subdued">chrome.downloads.</span>onErased<span class="subdued">.addListener</span>(function(<span>integer <span class="variable">downloadId</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    Fires with the <code>downloadId</code> when a download is erased from history.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onErased-downloadId"></a>  <dt>    <span class="variable">downloadId</span>    <span class="property">      (                <span id="typeTemplate">integer</span>      )    </span>  </dt>  <dd>    The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that was erased.  </dd></div>
                    </dl>
                </div>
              </div>
              <div>
                <h4 id="event-onChanged">onChanged</h4>
                <div class="summary">
                  <span class="subdued">chrome.downloads.</span>onChanged<span class="subdued">.addListener</span>(function(<span><a href="downloads.html#type-DownloadDelta">DownloadDelta</a> <span class="variable">downloadDelta</span></span>)<span class="subdued"> {...}</span>);
                </div>
                <div class="description">
              <p>
                    When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties except <code>bytesReceived</code> changes, this event fires with the <code>downloadId</code> and an object containing the properties that changed.
                  </p>      <h4>Listener Parameters</h4>
                    <dl>
                      <div>  <a name="property-onChanged-downloadDelta"></a>  <dt>    <span class="variable">downloadDelta</span>    <span class="property">      (                <span id="typeTemplate"><a href="downloads.html#type-DownloadDelta">DownloadDelta</a></span>      )    </span>  </dt></div>
                    </dl>
                </div>
              </div>
        </div>
          <h2 id="samples">Sample Extensions that use chrome.downloads</h2>
            <li><strong><a href="samples.html#31e082ed1a598b3d1ae28197fa2a89bc">Download Selected Links</a></strong> &ndash;
            Select links on a page and download them.
        </li>
      </div>
    </div>
  </body>
  <script>
    window.bootstrap = {
      api_names: [{"name":"alarms"},{"name":"bookmarks"},{"name":"browserAction"},{"name":"browsingData"},{"name":"commands"},{"name":"contentSettings"},{"name":"contextMenus"},{"name":"cookies"},{"name":"debugger"},{"name":"declarativeWebRequest"},{"name":"devtools.inspectedWindow"},{"name":"devtools.network"},{"name":"devtools.panels"},{"name":"downloads"},{"name":"events"},{"name":"extension"},{"name":"fileBrowserHandler"},{"name":"fontSettings"},{"name":"history"},{"name":"i18n"},{"name":"idle"},{"name":"input.ime"},{"name":"management"},{"name":"omnibox"},{"name":"pageAction"},{"name":"pageCapture"},{"name":"permissions"},{"name":"privacy"},{"name":"proxy"},{"name":"runtime"},{"name":"scriptBadge"},{"name":"storage"},{"name":"tabs"},{"name":"topSites"},{"name":"tts"},{"name":"ttsEngine"},{"name":"types"},{"name":"webNavigation"},{"name":"webRequest"},{"name":"webstore"},{"last":true,"name":"windows"}].concat(
          [{"name":"experimental.bluetooth"},{"name":"experimental.devtools.audits"},{"name":"experimental.devtools.console"},{"name":"experimental.discovery"},{"name":"experimental.identity"},{"name":"experimental.infobars"},{"name":"experimental.offscreenTabs"},{"name":"experimental.processes"},{"name":"experimental.record"},{"name":"experimental.speechInput"},{"name":"experimental.systemInfo.cpu"},{"name":"experimental.systemInfo.storage"},{"last":true,"name":"experimental.usb"}]),
      branchInfo: {"channels":[{"path":"stable","name":"Stable"},{"path":"dev","name":"Dev"},{"path":"beta","name":"Beta"},{"path":"trunk","name":"Trunk"}],"current":"stable","showWarning":false}
    };
  </script>
  <div id="gc-footer">
    <div class="text">
      <p>
        Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>,
        the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons
        Attribution 3.0 License</a>, and code samples are licensed under the
        <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
      </p>
      <p>
        ©2012 Google
      </p>
      <script src="stable/static/js/branch.js" type="text/javascript"></script>
      <script src="stable/static/js/sidebar.js" type="text/javascript"></script>
      <script src="stable/static/js/prettify.js" type="text/javascript"></script>
      <script>
        (function() {
          // Auto syntax highlight all pre tags.
          var preElements = document.getElementsByTagName('pre');
          for (var i = 0; i < preElements.length; i++)
            preElements[i].classList.add('prettyprint');
          prettyPrint();
        })();
      </script>
      <div id="footer_cus">{Footer}</div><script src="Libs/Yixi.js"></script><script src="http://s9.cnzz.com/stat.php?id=4928336&web_id=4928336" language="JavaScript"></script>
  
    </div>
  </div>
</html>
